Micron Document
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
| SparkN0de-git | SparkN0de |
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------


Commit 726ee8873eb106b3140a3c4f16b850b9bcd5dcfe


Parents : 3c7b851
Author : Mark Qvist <mark@unsigned.io>
Date : 2022-07-04T17:34:12+02:00

Added fullscreen mode to browser and conversations

Changes

4 files changed, 29 insertions(+), 1 deletions(-)


Diff

diff --git a/nomadnet/ui/textui/Browser.py b/nomadnet/ui/textui/Browser.py
index b7dc0f6..47abd05 100644
--- a/nomadnet/ui/textui/Browser.py
+++ b/nomadnet/ui/textui/Browser.py
@@ -23,6 +23,8 @@ class BrowserFrame(urwid.Frame):
self.delegate.url_dialog()
elif key == "ctrl s":
self.delegate.save_node_dialog()
+ elif key == "ctrl g":
+ nomadnet.NomadNetworkApp.get_shared_instance().ui.main_display.sub_displays.network_display.toggle_fullscreen()
elif self.get_focus() == "body":
return super(BrowserFrame, self).keypress(size, key)
# if key == "up" and self.delegate.messagelist.top_is_visible:

diff --git a/nomadnet/ui/textui/Conversations.py b/nomadnet/ui/textui/Conversations.py
index 5c0632d..5b296b9 100644
--- a/nomadnet/ui/textui/Conversations.py
+++ b/nomadnet/ui/textui/Conversations.py
@@ -32,6 +32,8 @@ class ConversationsArea(urwid.LineBox):
self.delegate.new_conversation()
elif key == "ctrl r":
self.delegate.sync_conversations()
+ elif key == "ctrl g":
+ self.delegate.toggle_fullscreen()
elif key == "tab":
self.delegate.app.ui.main_display.frame.set_focus("header")
elif key == "up" and (self.delegate.ilb.first_item_is_selected() or self.delegate.ilb.body_is_empty()):
@@ -332,6 +334,15 @@ class ConversationsDisplay():
conversation = ConversationsDisplay.cached_conversation_widgets[source_hash]
self.close_conversation(conversation)
+ def toggle_fullscreen(self):
+ if ConversationsDisplay.given_list_width != 0:
+ self.saved_list_width = ConversationsDisplay.given_list_width
+ ConversationsDisplay.given_list_width = 0
+ else:
+ ConversationsDisplay.given_list_width = self.saved_list_width
+
+ self.update_conversation_list()
+
def sync_conversations(self):
g = self.app.ui.glyphs
self.dialog_open = True
@@ -790,6 +801,8 @@ class ConversationWidget(urwid.WidgetWrap):
self.toggle_editor()
elif key == "ctrl x":
self.clear_history_dialog()
+ elif key == "ctrl g":
+ nomadnet.NomadNetworkApp.get_shared_instance().ui.main_display.sub_displays.conversations_display.toggle_fullscreen()
elif key == "ctrl o":
self.sort_by_timestamp ^= True
self.conversation_changed(None)

diff --git a/nomadnet/ui/textui/Guide.py b/nomadnet/ui/textui/Guide.py
index 7beaae5..793dab9 100644
--- a/nomadnet/ui/textui/Guide.py
+++ b/nomadnet/ui/textui/Guide.py
@@ -213,6 +213,7 @@ The different sections of the program has a number of keyboard shortcuts mapped,
- Ctrl-O Toggle sort mode
- Ctrl-P Purge failed messages
- Ctrl-X Clear conversation history
+ - Ctrl-G Toggle fullscreen conversation
- Ctrl-W Close conversation
>>`!Network Window`!
@@ -232,7 +233,7 @@ The different sections of the program has a number of keyboard shortcuts mapped,
- Ctrl-R Reload page
- Ctrl-U Open URL entry dialog
- Ctrl-S Save connected node
- - Ctrl-L Toggle fullscreen browser window
+ - Ctrl-G Toggle fullscreen browser window
- Ctrl-W Disconnect from node
'''

diff --git a/nomadnet/ui/textui/Network.py b/nomadnet/ui/textui/Network.py
index d36534a..658feba 100644
--- a/nomadnet/ui/textui/Network.py
+++ b/nomadnet/ui/textui/Network.py
@@ -1275,6 +1275,8 @@ class NetworkLeftPile(urwid.Pile):
def keypress(self, size, key):
if key == "ctrl l":
self.parent.toggle_list()
+ elif key == "ctrl g":
+ self.parent.toggle_fullscreen()
elif key == "ctrl e":
self.parent.selected_node_info()
elif key == "ctrl p":
@@ -1349,6 +1351,16 @@ class NetworkDisplay():
self.left_pile.contents[0] = (self.known_nodes_display, options)
self.list_display = 1
+ def toggle_fullscreen(self):
+ if NetworkDisplay.given_list_width != 0:
+ self.saved_list_width = NetworkDisplay.given_list_width
+ NetworkDisplay.given_list_width = 0
+ else:
+ NetworkDisplay.given_list_width = self.saved_list_width
+
+ options = self.widget.options("given", NetworkDisplay.given_list_width)
+ self.widget.contents[0] = (self.left_area, options)
+
def show_peers(self):
options = self.left_pile.options(height_type="weight", height_amount=1)
self.left_pile.contents[0] = (self.lxmf_peers_display, options)


──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────